home *** CD-ROM | disk | FTP | other *** search
/ Windows Game Programming for Dummies (2nd Edition) / WinGamProgFD.iso / pc / DirectX SDK / DXSDK / samples / Multimedia / VBSamples / Misc / DXSetup / dskspace.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  2001-10-08  |  12.8 KB  |  383 lines

  1. VERSION 5.00
  2. Begin VB.Form frmDskSpace 
  3.    AutoRedraw      =   -1  'True
  4.    BorderStyle     =   3  'Fixed Dialog
  5.    Caption         =   "#"
  6.    ClientHeight    =   2550
  7.    ClientLeft      =   870
  8.    ClientTop       =   1530
  9.    ClientWidth     =   5355
  10.    ClipControls    =   0   'False
  11.    BeginProperty Font 
  12.       Name            =   "MS Sans Serif"
  13.       Size            =   8.25
  14.       Charset         =   0
  15.       Weight          =   700
  16.       Underline       =   0   'False
  17.       Italic          =   0   'False
  18.       Strikethrough   =   0   'False
  19.    EndProperty
  20.    HasDC           =   0   'False
  21.    Icon            =   "dskspace.frx":0000
  22.    MaxButton       =   0   'False
  23.    MinButton       =   0   'False
  24.    NegotiateMenus  =   0   'False
  25.    ScaleHeight     =   2550
  26.    ScaleWidth      =   5355
  27.    ShowInTaskbar   =   0   'False
  28.    Begin VB.CommandButton cmdChgDrv 
  29.       Caption         =   "#"
  30.       Default         =   -1  'True
  31.       BeginProperty Font 
  32.          Name            =   "MS Sans Serif"
  33.          Size            =   8.25
  34.          Charset         =   0
  35.          Weight          =   400
  36.          Underline       =   0   'False
  37.          Italic          =   0   'False
  38.          Strikethrough   =   0   'False
  39.       EndProperty
  40.       Height          =   420
  41.       Left            =   195
  42.       MaskColor       =   &H00000000&
  43.       TabIndex        =   2
  44.       Top             =   1965
  45.       Width           =   1560
  46.    End
  47.    Begin VB.CommandButton cmdInstall 
  48.       Caption         =   "#"
  49.       BeginProperty Font 
  50.          Name            =   "MS Sans Serif"
  51.          Size            =   8.25
  52.          Charset         =   0
  53.          Weight          =   400
  54.          Underline       =   0   'False
  55.          Italic          =   0   'False
  56.          Strikethrough   =   0   'False
  57.       EndProperty
  58.       Height          =   420
  59.       Left            =   1875
  60.       MaskColor       =   &H00000000&
  61.       TabIndex        =   1
  62.       Top             =   1965
  63.       Width           =   1560
  64.    End
  65.    Begin VB.CommandButton cmdExit 
  66.       Cancel          =   -1  'True
  67.       Caption         =   "#"
  68.       BeginProperty Font 
  69.          Name            =   "MS Sans Serif"
  70.          Size            =   8.25
  71.          Charset         =   0
  72.          Weight          =   400
  73.          Underline       =   0   'False
  74.          Italic          =   0   'False
  75.          Strikethrough   =   0   'False
  76.       EndProperty
  77.       Height          =   420
  78.       Left            =   3570
  79.       MaskColor       =   &H00000000&
  80.       TabIndex        =   0
  81.       Top             =   1965
  82.       Width           =   1560
  83.    End
  84.    Begin VB.Label lblNoSpace 
  85.       AutoSize        =   -1  'True
  86.       Caption         =   "#"
  87.       BeginProperty Font 
  88.          Name            =   "MS Sans Serif"
  89.          Size            =   8.25
  90.          Charset         =   0
  91.          Weight          =   400
  92.          Underline       =   0   'False
  93.          Italic          =   0   'False
  94.          Strikethrough   =   0   'False
  95.       EndProperty
  96.       Height          =   195
  97.       Left            =   195
  98.       TabIndex        =   11
  99.       Top             =   150
  100.       Width           =   105
  101.    End
  102.    Begin VB.Shape shpHeading 
  103.       BorderColor     =   &H00000000&
  104.       Height          =   480
  105.       Left            =   195
  106.       Top             =   750
  107.       Width           =   4980
  108.    End
  109.    Begin VB.Label lblReqH 
  110.       Alignment       =   1  'Right Justify
  111.       Caption         =   "#"
  112.       BeginProperty Font 
  113.          Name            =   "MS Sans Serif"
  114.          Size            =   8.25
  115.          Charset         =   0
  116.          Weight          =   400
  117.          Underline       =   0   'False
  118.          Italic          =   0   'False
  119.          Strikethrough   =   0   'False
  120.       EndProperty
  121.       Height          =   405
  122.       Left            =   810
  123.       TabIndex        =   10
  124.       Top             =   810
  125.       Width           =   1260
  126.       WordWrap        =   -1  'True
  127.    End
  128.    Begin VB.Label lblNeedH 
  129.       Alignment       =   1  'Right Justify
  130.       Caption         =   "#"
  131.       BeginProperty Font 
  132.          Name            =   "MS Sans Serif"
  133.          Size            =   8.25
  134.          Charset         =   0
  135.          Weight          =   400
  136.          Underline       =   0   'False
  137.          Italic          =   0   'False
  138.          Strikethrough   =   0   'False
  139.       EndProperty
  140.       Height          =   405
  141.       Left            =   3885
  142.       TabIndex        =   9
  143.       Top             =   810
  144.       Width           =   1260
  145.       WordWrap        =   -1  'True
  146.    End
  147.    Begin VB.Label lblAvailH 
  148.       Alignment       =   1  'Right Justify
  149.       Caption         =   "#"
  150.       BeginProperty Font 
  151.          Name            =   "MS Sans Serif"
  152.          Size            =   8.25
  153.          Charset         =   0
  154.          Weight          =   400
  155.          Underline       =   0   'False
  156.          Italic          =   0   'False
  157.          Strikethrough   =   0   'False
  158.       EndProperty
  159.       Height          =   405
  160.       Left            =   2355
  161.       TabIndex        =   8
  162.       Top             =   810
  163.       Width           =   1260
  164.       WordWrap        =   -1  'True
  165.    End
  166.    Begin VB.Label lblDiskH 
  167.       AutoSize        =   -1  'True
  168.       Caption         =   "#"
  169.       BeginProperty Font 
  170.          Name            =   "MS Sans Serif"
  171.          Size            =   8.25
  172.          Charset         =   0
  173.          Weight          =   400
  174.          Underline       =   0   'False
  175.          Italic          =   0   'False
  176.          Strikethrough   =   0   'False
  177.       EndProperty
  178.       Height          =   195
  179.       Left            =   240
  180.       TabIndex        =   7
  181.       Top             =   1005
  182.       Width           =   105
  183.    End
  184.    Begin VB.Shape shpSpace 
  185.       BorderColor     =   &H00000000&
  186.       Height          =   390
  187.       Left            =   195
  188.       Top             =   1230
  189.       Width           =   4980
  190.    End
  191.    Begin VB.Label lblReq 
  192.       Alignment       =   1  'Right Justify
  193.       BorderStyle     =   1  'Fixed Single
  194.       BeginProperty Font 
  195.          Name            =   "MS Sans Serif"
  196.          Size            =   8.25
  197.          Charset         =   0
  198.          Weight          =   400
  199.          Underline       =   0   'False
  200.          Italic          =   0   'False
  201.          Strikethrough   =   0   'False
  202.       EndProperty
  203.       Height          =   210
  204.       Index           =   0
  205.       Left            =   810
  206.       TabIndex        =   6
  207.       Top             =   1305
  208.       Visible         =   0   'False
  209.       Width           =   1260
  210.    End
  211.    Begin VB.Label lblNeed 
  212.       Alignment       =   1  'Right Justify
  213.       BorderStyle     =   1  'Fixed Single
  214.       BeginProperty Font 
  215.          Name            =   "MS Sans Serif"
  216.          Size            =   8.25
  217.          Charset         =   0
  218.          Weight          =   400
  219.          Underline       =   0   'False
  220.          Italic          =   0   'False
  221.          Strikethrough   =   0   'False
  222.       EndProperty
  223.       Height          =   210
  224.       Index           =   0
  225.       Left            =   3885
  226.       TabIndex        =   5
  227.       Top             =   1305
  228.       Visible         =   0   'False
  229.       Width           =   1260
  230.    End
  231.    Begin VB.Label lblAvail 
  232.       Alignment       =   1  'Right Justify
  233.       BorderStyle     =   1  'Fixed Single
  234.       BeginProperty Font 
  235.          Name            =   "MS Sans Serif"
  236.          Size            =   8.25
  237.          Charset         =   0
  238.          Weight          =   400
  239.          Underline       =   0   'False
  240.          Italic          =   0   'False
  241.          Strikethrough   =   0   'False
  242.       EndProperty
  243.       Height          =   210
  244.       Index           =   0
  245.       Left            =   2340
  246.       TabIndex        =   4
  247.       Top             =   1305
  248.       Visible         =   0   'False
  249.       Width           =   1260
  250.    End
  251.    Begin VB.Label lblDisk 
  252.       AutoSize        =   -1  'True
  253.       BorderStyle     =   1  'Fixed Single
  254.       BeginProperty Font 
  255.          Name            =   "MS Sans Serif"
  256.          Size            =   8.25
  257.          Charset         =   0
  258.          Weight          =   400
  259.          Underline       =   0   'False
  260.          Italic          =   0   'False
  261.          Strikethrough   =   0   'False
  262.       EndProperty
  263.       Height          =   210
  264.       Index           =   0
  265.       Left            =   240
  266.       TabIndex        =   3
  267.       Top             =   1305
  268.       Visible         =   0   'False
  269.       Width           =   510
  270.    End
  271. Attribute VB_Name = "frmDskSpace"
  272. Attribute VB_GlobalNameSpace = False
  273. Attribute VB_Creatable = False
  274. Attribute VB_PredeclaredId = True
  275. Attribute VB_Exposed = False
  276. Option Explicit
  277. Private Const mstrFMT$ = "######0 K"
  278. Private Sub cmdChgDrv_Click()
  279.     gintRetVal = gintRET_CANCEL
  280.     Unload Me
  281. End Sub
  282. Private Sub cmdExit_Click()
  283.     ExitSetup Me, gintRET_EXIT
  284. End Sub
  285. Private Sub cmdInstall_Click()
  286.     gintRetVal = gintRET_CONT
  287.     Unload Me
  288. End Sub
  289. Private Sub Form_Load()
  290.     Const ONE_K& = 1024
  291.     Dim intIdx As Integer
  292.     Dim lAvail As Long
  293.     Dim lReq As Long
  294.     Dim lTmp As Long
  295.     Dim intHeight As Integer
  296.     Dim intTop As Integer
  297.     Dim sDrive As String
  298.     Dim nCurrentWidth As Single
  299.     Dim nMaxWidth As Single
  300.     nCurrentWidth = lblDisk(0).Width
  301.     nMaxWidth = nCurrentWidth
  302.     SetFormFont Me
  303.     cmdExit.Caption = ResolveResString(resBTNEXIT)
  304.     cmdInstall.Caption = ResolveResString(resBTNINSTALLNOW)
  305.     cmdChgDrv.Caption = ResolveResString(resBTNCHGDRV)
  306.     lblDiskH.Caption = ResolveResString(resLBLDRIVE)
  307.     lblAvailH.Caption = ResolveResString(resLBLAVAIL)
  308.     lblNeedH.Caption = ResolveResString(resLBLNEEDED)
  309.     lblReqH.Caption = ResolveResString(resLBLREQUIRED)
  310.     lblNoSpace.Caption = ResolveResString(resLBLNOSPACE)
  311.     frmDskSpace.Caption = gstrTitle
  312.     intHeight = lblDisk(0).Height * 1.6
  313.     intTop = lblDisk(0).Top
  314.     '
  315.     'borders are for design mode only...
  316.     '
  317.     lblDisk(0).BorderStyle = vbTransparent
  318.     lblReq(0).BorderStyle = vbTransparent
  319.     lblAvail(0).BorderStyle = vbTransparent
  320.     lblNeed(0).BorderStyle = vbTransparent
  321.     For intIdx = 1 To DriveCount
  322.         Load lblDisk(intIdx)
  323.         Load lblReq(intIdx)
  324.         Load lblAvail(intIdx)
  325.         Load lblNeed(intIdx)
  326.         lAvail = gsDiskSpace(intIdx).lAvail
  327.         lReq = gsDiskSpace(intIdx).lReq
  328.         sDrive = DriveFromDriveIndex(intIdx)
  329.         RemoveDirSep sDrive
  330.         lblDisk(intIdx).Caption = sDrive
  331.         If lblDisk(intIdx).Width > nMaxWidth Then
  332.             nMaxWidth = lblDisk(intIdx).Width
  333.         End If
  334.         lblReq(intIdx).Caption = Format$(lReq / ONE_K, mstrFMT)
  335.         lblAvail(intIdx).Caption = Format$(lAvail / ONE_K, mstrFMT)
  336.         If lReq > lAvail Then
  337.             lTmp = lReq - lAvail
  338.         Else
  339.             lTmp = 0
  340.         End If
  341.         lblNeed(intIdx).Caption = Format$(lTmp / ONE_K, mstrFMT)
  342.         lblDisk(intIdx).Top = intTop
  343.         lblReq(intIdx).Top = intTop
  344.         lblAvail(intIdx).Top = intTop
  345.         lblNeed(intIdx).Top = intTop
  346.         intTop = intTop + intHeight
  347.         lblDisk(intIdx).Visible = True
  348.         lblReq(intIdx).Visible = True
  349.         lblAvail(intIdx).Visible = True
  350.         lblNeed(intIdx).Visible = True
  351.     Next intIdx
  352.     If nMaxWidth <> nCurrentWidth Then
  353.         nMaxWidth = nMaxWidth - nCurrentWidth
  354.         For intIdx = 1 To DriveCount
  355.             lblReq(intIdx).Left = lblReq(intIdx).Left + nMaxWidth
  356.             lblAvail(intIdx).Left = lblAvail(intIdx).Left + nMaxWidth
  357.             lblNeed(intIdx).Left = lblNeed(intIdx).Left + nMaxWidth
  358.         Next intIdx
  359.         lblReqH.Left = lblReqH.Left + nMaxWidth
  360.         lblAvailH.Left = lblAvailH.Left + nMaxWidth
  361.         lblNeedH.Left = lblNeedH.Left + nMaxWidth
  362.         shpHeading.Width = shpHeading.Width + nMaxWidth
  363.         shpSpace.Width = shpSpace.Width + nMaxWidth
  364.         Width = Width + nMaxWidth
  365.         nMaxWidth = nMaxWidth / 3
  366.         cmdChgDrv.Width = cmdChgDrv.Width + nMaxWidth
  367.         cmdInstall.Left = cmdInstall.Left + nMaxWidth
  368.         cmdInstall.Width = cmdInstall.Width + nMaxWidth
  369.         cmdExit.Left = cmdExit.Left + (2 * nMaxWidth)
  370.         cmdExit.Width = cmdExit.Width + nMaxWidth
  371.     End If
  372.     shpSpace.Height = intHeight * (intIdx - 1)
  373.     cmdChgDrv.Top = shpSpace.Top + shpSpace.Height + cmdChgDrv.Height
  374.     cmdInstall.Top = cmdChgDrv.Top
  375.     cmdExit.Top = cmdChgDrv.Top
  376.     frmDskSpace.Height = cmdChgDrv.Top + cmdChgDrv.Height * 2.5
  377.     EtchedLine Me, 100, cmdChgDrv.Top - cmdChgDrv.Height * 0.5, ScaleWidth - 200
  378.     CenterForm Me
  379. End Sub
  380. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
  381.     HandleFormQueryUnload UnloadMode, Cancel, Me
  382. End Sub
  383.